<template>
  <div class="modern-page error-page">
    <div class="error-content modern-card modern-slide-in">
      <div class="error-icon modern-float">
        <component :is="'AlertTriangleIcon'" />
      </div>
      <div class="error-code modern-text-gradient error-code-500">500</div>
      <div class="error-title">服务器内部错误</div>
      <div class="error-description">
        抱歉，服务器遇到了一个错误，我们正在努力修复中
      </div>
      <div class="error-actions">
        <t-button 
          theme="primary" 
          size="large"
          class="modern-btn-enhance"
          @click="retry"
        >
          <template #icon>
            <component :is="'RefreshIcon'" />
          </template>
          重新尝试
        </t-button>
        <t-button 
          variant="outline" 
          size="large"
          @click="goHome"
        >
          <template #icon>
            <component :is="'HomeIcon'" />
          </template>
          返回首页
        </t-button>
        <t-button 
          variant="text" 
          size="large"
          @click="contactSupport"
        >
          <template #icon>
            <component :is="'MessageCircleIcon'" />
          </template>
          联系客服
        </t-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { MessagePlugin } from 'tdesign-vue-next'

const router = useRouter()

const retry = () => {
  window.location.reload()
}

const goHome = () => {
  router.push('/dashboard')
}

const contactSupport = () => {
  MessagePlugin.info('客服功能开发中...')
}
</script>

<style lang="scss" scoped>
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.error-content {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 500px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.error-icon {
  font-size: 4rem;
  color: #f59e0b;
  margin-bottom: 1.5rem;
  animation: pulse 2s infinite;
}

.error-code-500 {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 7.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 1.25rem;
  letter-spacing: -0.05em;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.75rem;
}

.error-description {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

:deep(.t-button) {
  border-radius: 12px;
  height: 3rem;
  padding: 0 1.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

:deep(.t-button--theme-primary) {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
}

:deep(.t-button--theme-primary:hover) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

:deep(.t-button--variant-outline) {
  border: 2px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(5px);
}

:deep(.t-button--variant-outline:hover) {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

:deep(.t-button--variant-text) {
  background: transparent;
  color: #6b7280;
}

:deep(.t-button--variant-text:hover) {
  background: rgba(107, 114, 128, 0.1);
  color: #374151;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

// 响应式设计
@media (max-width: 640px) {
  .error-content {
    padding: 2rem 1.5rem;
  }
  
  .error-code-500 {
    font-size: 5rem;
  }
  
  .error-actions {
    flex-direction: column;
    align-items: center;
    
    :deep(.t-button) {
      min-width: 200px;
    }
  }
}
</style> 